﻿using CServiceStack.ServiceHost;
using CServiceStack.ServiceModel.Serialization;
using CServiceStack.Text;
using CServiceStack.WebHost.Endpoints;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SomeServices
{
    public class SomeFormat:IPlugin
    {
        public void Register(IAppHost appHost)
        {
            appHost.ContentTypeFilters.Register("application/some", Serialize, WrappedJsonDeserializer.Instance.DeserializeFromStream);
        }

        public static void Serialize(IRequestContext requestContext, object dto, Stream outputStream)
        {
            WrappedJsonSerializer.Instance.SerializeToStream(dto, outputStream);
        }
    }
}
